package org.openrbac.rbac.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.openrbac.rbac.entity.Image;

import java.util.List;

/**
* @author 梁富贵
* @description 针对表【image】的数据库操作Mapper
* @createDate 2024-05-06 19:39:11
* @Entity org.openrbac.rbac.entity.Image
*/
@Mapper
public interface ImageMapper extends BaseMapper<Image> {

    @Select("select image.id,image.name,image.url " +
            "from img_pro left join image on image.id = img_pro.iid " +
            "where img_pro.type = #{type}")
    List<Image> getImagesShowByType(@Param("type") String type);

//    @Select("select image.name,image.url  from img_pro left join image on img_pro.iid = image.id " +
//            "where img_pro.type = 'normal'")
    @Select("<script>"+
            "select image.name,image.url from image where id in" +
            "<foreach collection='ids' item='item' open='(' separator=',' close=')'>" +
            "#{item}" +
            "</foreach>" +
            "</script>")
    List<Image> getRecommandImg(@Param("ids") List<Integer> ids);
}




